<?php

namespace App\ViewModels;

use App\Models\ConnectionsTypesModel;

class ConnectionsViewModel extends BaseViewModel
{
    public function getConnectionsNamesAndProperties()
    {
        return ConnectionsTypesModel::query()->get(['connection', 'parameters']);
    }

    public function getAllConnectionRulesByName(string $name)
    {
        return ConnectionsTypesModel::query()->where('connection', '=', $name)->first()->parameters;
    }

    public function getConnectionNames()
    {
        return ConnectionsTypesModel::query()->pluck('connection')->toArray();
    }
}
